package com.huawei.smartcity0102.util;

import androidx.lifecycle.MutableLiveData;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author ZengYunyi
 * @description:
 * @date :2022/1/2 14:03
 */
public class XC {
    public MutableLiveData<AtomicInteger> livedata=new MutableLiveData<>();
    AtomicInteger ints =new AtomicInteger(0);
    ExecutorService ser;
    int num;

    public XC(int num) {
        this.num = num;
    }

    public void then(Runnable runnable){
        if(ser==null){
            ser= Executors.newFixedThreadPool(num);
        }
        ser.execute(runnable);
    }
    public void adds(){
        ints.getAndIncrement();
        livedata.postValue(ints);
    }
}
